// /////////////////////////////////////////////////////////////////////////////
//
// Name:            asBillboardComponent.cpp
// Author:          Michael Bartsch (ZCCdark203)
//
// Desc :           Binds the BillboardComponent class to AngelScript
//
// License:         Copyright (C) 2009 Michael Bartsch and Contributors
//
//                  This program is free software: you can redistribute it
//                  and/or modify it under the terms of the zlib/libpng License.
//                  See main.cpp for conditions of distribution and use.
//
// /////////////////////////////////////////////////////////////////////////////

// Include files
#include "asBillboardComponent.h"

#ifdef __COMPILE_WITH_ANGELSCRIPT__

#include "../../ScriptHelper.h"


//! Reference factory for the BillboardComponent class.
BillboardComponent* createBillboardComponent(Entity *parent)
{
    return new BillboardComponent(parent);
}

//! Reference factory for the BillboardComponent class.
BillboardComponent* createBillboardComponent(Entity *parent, const dimension2df &size,
                                             const SColor &colorTop, const SColor &colorBottom)
{
    return new BillboardComponent(parent, size, colorTop, colorBottom);
}

//! Binds the BillboardComponent class to AngelScript.
void bindBillboardComponent(asIScriptEngine *engine)
{
    // Forward declarations.
    int r;

    // Bind BillboardComponent class.
    r = engine->RegisterObjectType("BillboardComponent", sizeof(BillboardComponent), asOBJ_REF); assert(r >= 0);

    // Bind base functions.
    bindBillboardComponentBase<BillboardComponent>(engine, "BillboardComponent");

    // Set BillboardComponent behaviour.
    r = engine->RegisterObjectBehaviour("BillboardComponent", asBEHAVE_FACTORY, "BillboardComponent@ f(Entity @+)",
                                        asFUNCTIONPR(createBillboardComponent, (Entity*), BillboardComponent*),
                                        asCALL_CDECL); assert(r >= 0);
    r = engine->RegisterObjectBehaviour("BillboardComponent", asBEHAVE_FACTORY, "BillboardComponent@ f(Entity @+, " \
                                        "const dimension2df &in, const SColor &in, const SColor &in)",
                                        asFUNCTIONPR(createBillboardComponent, (Entity*, const dimension2df&,
                                        const SColor&, const SColor&), BillboardComponent*),
                                        asCALL_CDECL); assert(r >= 0);

    r = engine->RegisterObjectMethod("BillboardComponent", "BillboardComponent& opAssign(const BillboardComponent &in)",
                                     asFUNCTION(assignT<BillboardComponent>), asCALL_CDECL_OBJFIRST); assert(r >= 0);
}

#endif // __COMPILE_WITH_ANGELSCRIPT__

// End of File
